﻿#ifndef _tcp_server_20220407_
#define _tcp_server_20220407_

#include <thread>
#include <map>
#include <list>
#include <mutex>
#include "SL_asynFramePub.h"

#include "SLT_tool_pub_def.h"
#include "SL_tcpClient.h"
class SLTcpServerCB
{
public:
	virtual void TcpServer_onConnect(SLTcpClientPtr& _client) = 0;
	virtual void TcpServer_onError() = 0;
};
class SLTcpServer
{
public:
	virtual int  init(SLTcpServerCB* pcb) = 0;
	virtual void uninit() = 0;
	virtual void start() = 0;
	virtual void stop() = 0;
	virtual int addListen(std::string _ip, int _port) = 0;
    virtual int delListen(std::string _ip, int _port) = 0;

	virtual SLTcpClientPtr   createClient() = 0;
};
typedef std::shared_ptr<SLTcpServer> SLTcpServerStpr;

SLT_API SLTcpServerStpr sl_createTcpServer();


#endif